<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>上传作品 - <?php echo $cfg_webname; ?></title>
	<link href="templets/style/css/reset.css" rel="stylesheet" type="text/css">
	<link href="templets/style/css/member.css" rel="stylesheet" type="text/css">
	<link href="templets/style/up.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="templets/js/j.js"></script>
	<script type="text/javascript" src="templets/js/load.js"></script>
	<script type="text/javascript" src="templets/js/leftmenu.js"></script>
	<script type="text/javascript" language='javascript' src="templets/js/main.js"></script>
	<script type="text/javascript" src="templets/js/checkSubmit.js"></script>
	<script type="text/javascript" src="upface/ajaxupload.3.5.js"></script>
	<script type="text/javascript" charset="utf-8" src="../include/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="../include/ueditor/ueditor.all.js"></script>
	<link rel="stylesheet" type="text/css" href="../include/ueditor/themes/default/css/ueditor.css"/>
	<link rel="stylesheet" type="text/css" href="webupload/webuploader.css" />
	<link rel="stylesheet" type="text/css" href="webupload/style.css" />
	<link rel="stylesheet" type="text/css" href="bootstrap/css/css.css" />
	<style>
		h6 dt{width:100px !important;}
		#wrapper dt {  margin-left: 0; }
		.uploader-container dt {  margin-left: 0; }
		#wrapper li { padding-left: 0 }
		#lit-view{display: none}
		#lit-view img{max-height: 100px;max-width: 200px;}
		#litpicPicker{line-height: normal !important;}
		#zipPicker{line-height: normal !important;}
		.progress-bar{background-color: #3F92D6;height:3px;border: 1px #3F92D6 solid;}
		.progress{width:100%;background-color: #ccc;}
		#softurl5{margin-bottom: 10px;}
		/*#uploadLitpic{position: absolute; opacity: 0; filter:Alpha(opacity=0);}*/
		.tips, .dtip {
			padding: 15px;
			margin: 5px auto 15px auto;
			color: #F30;
			font-family: Tahoma,Geneva,sans-serif;
			background: #ffd;
			border: 1px solid #EDEDBE;
			border-radius: 5px;
		}
		.tips i{  display: block;
			width: 15px;
			height: 15px;
			float: left;
			margin-right: 10px;
			overflow: hidden;}
		#tips12,#tips13{position: absolute;display:none;text-align: left;z-index:999;color:#7f7e7d}
		.tip1,.tip2{cursor: pointer}

	</style>
</head>
<body>

<!--head-->
<?php include(DEDEMEMBER. "/templets/head.htm"); ?>


<div class="main">

	<?php include(DEDEMEMBER."/templets/menu.php"); ?>

	<div class="main_right">

		<form class="mTB10 mR10 mL10" name="addcontent" action="soft_add.php" method="post" enctype="multipart/form-data" onsubmit="return checkSubmit();">
			<input type="hidden" name="dopost" value="newsave" />
			<input type="hidden" name="channelid" value="<?php echo $channelid; ?>" />
			<input type="hidden" name="writer" value="<?php echo $cfg_ml->M_UserName?>" />
			<input type="hidden" name="dede_fieldshash" value="<?php echo md5($formfields.$cfg_cookie_encode);?>" />
			<input type="hidden" name="dows" value="0" />
			<input type="hidden" name="stows" value="0" />
			<input type='hidden' name='dede_addonfields' value="mbcx,select;mblx,select;mbhy,select;mbys,select;mbbm,select;version,text;goods,radio;pan_baidu,text;pan_baidu_mima,text;dows,int;stows,int">
			<input type="hidden" id="litpics" name="addlitpic" value="" />
			<!-- <input type="hidden" id="previewurl" name="previewurl" value="" /> -->
			<div id="mainCp">
				<div class="postForm upsucai-new">
					<dl>
						<dt>栏目类别 <small>*</small></dt>
						<dd> <?php
    		$typeOptions = GetOptionList(0,$channelid);
    		echo "<select name='typeid' size='1'>\r\n";
							echo "<option value='0' selected>请选择栏目...</option>\r\n";
							echo $typeOptions;
							echo "</select>";
							?>
						</dd>
					</dl>


					<dl>
						<dt>素材标题 <small>*</small></dt>
						<dd><input name="title" type="text" id="title" maxlength="100" autocomplete="off" class="intxt" placeholder="准确，有吸引力的标题非常重要" /></dd>
					</dl>
					<dl>
						<dt>百度网盘 <small>*</small></dt>
						<dd><input name="pan_baidu" type="text" id="bdwp" maxlength="100" autocomplete="off" class="intxt" /></dd>
					</dl>
					<dl>
						<dt>网盘密码 <small>*</small></dt>
						<dd><input name="pan_baidu_mima" type="text" id="wpmm" maxlength="100" autocomplete="off" class="intxt"/></dd>
					</dl>
					<dl style="display: none">
						<dt>模板售价 <small>*</small></dt>
						<dd><input name="needmoney" type="text" class="intxt needmoney" value="0" autocomplete="off" />金币，免费请填写0</dd>
					</dl>
					<div class="up-add">

						<dt>主图图片 <small>*</small></dt>
						<button id="upload_button" type="button"><i id="upmsg">选择文件 (主图大小限制2M以内)</i></button>
						<img src="" id="litpic"  width="200" style="margin-left:135px;margin-top:5px;">

						<p id="loadimg"><img src="<?php echo $cfg_skin; ?>/images/loading.gif" /></p>
					</div>
					<dl style="display: none">
						<dt>系统品牌 <small>*</small></dt>
						<dd>
							<select name="mbcx" id="sc_chicun_select" style="width:561px;">
								<option value='织梦'>织梦</option>
								<option value='帝国'>帝国</option>
								<option value='Discuz'>Discuz</option>
								<option value='wordpress'>wordpress</option>
								<option value='ecshop'>ecshop</option>
								<option value='phpcms'>phpcms</option>
								<option value='其它'>其它</option>
							</select>
						</dd>
					</dl>
					<dl style="display: none">
						<dt>模板类型 <small>*</small></dt>
						<dd>
							<select name="mblx" id="sc_chicun_select" style="width:561px;">
								<option value='纯PC模板'>纯PC模板</option>
								<option value='纯移动端模板'>纯移动端模板</option>
								<option value='PC端+单独移动端'>PC端+单独移动端</option>
								<option value='自适应'>自适应</option>
							</select>
						</dd>
					</dl>
					<dl style="display: none">
						<dt>所属行业 <small>*</small></dt>
						<dd>
							<select name="mbhy" id="sc_chicun_select" style="width:561px;">
								<option value='网络公司'>网络公司</option>
								<option value='文章资讯'>文章资讯</option>
								<option value='淘客返利'>淘客返利</option>
								<option value='图片素材'>图片素材</option>
								<option value='软件下载'>软件下载</option>
								<option value='电影音乐'>电影音乐</option>
								<option value='游戏动漫'>游戏动漫</option>
								<option value='威客任务'>威客任务</option>
								<option value='购物商城'>购物商城</option>
								<option value='o2o系统'>o2o系统</option>
								<option value='建筑装饰'>建筑装饰</option>
								<option value='建材家具'>建材家具</option>
								<option value='机械设备'>机械设备</option>
								<option value='电子数码'>电子数码</option>
								<option value='汽车服务'>汽车服务</option>
								<option value='医院医疗'>医院医疗</option>
								<option value='教育培训'>教育培训</option>
								<option value='广告设计'>广告设计</option>
								<option value='母婴家政'>母婴家政</option>
								<option value='餐饮酒店'>餐饮酒店</option>
								<option value='旅游婚庆'>旅游婚庆</option>
								<option value='金融借贷'>金融借贷</option>
								<option value='房产租售'>房产租售</option>
								<option value='通用其他'>通用其他</option>
							</select>
						</dd>
					</dl>
					<dl style="display: none">
						<dt>颜色分类 <small>*</small></dt>

						<dd>
							<select name="mbys" id="sc_chicun_select" style="width:561px;">
								<option value='红色'>红色</option>
								<option value='橙色'>橙色</option>
								<option value='黄色'>黄色</option>
								<option value='绿色'>绿色</option>
								<option value='粉色'>粉色</option>
								<option value='蓝色'>蓝色</option>
								<option value='紫色'>紫色</option>
								<option value='黑色'>黑色</option>
								<option value='灰色'>灰色</option>
								<option value='白色'>白色</option>
								<option value='咖啡色'>咖啡色</option>
								<option value='多色'>多色</option>
							</select>
						</dd>
					</dl>
					<dl style="display: none">
						<dt>编码 <small>*</small></dt>
						<dd>
							<select name="mbbm" id="sc_chicun_select" style="width:561px;">
								<option value='gbk'>gbk</option>
								<option value='utf8'>utf8</option>
							</select>
						</dd>
					</dl>
					<dl style="display: none">
						<dt>文件版本</dt>
						<dd>
							<input type='text' name='version' id='version' style='width:250px'  class='intxt'placeholder="如：dedecms5.7" value='' />
						</dd>
					</dl>
					<dl style="display:none;">
						<dt>文件大小</dt>
						<dd>
							<input type='text' name='softsize' id='softsize' style='width:250px'  class='intxt' placeholder="如：59.8mb"  value='' />MB
						</dd>

					</dl>



					<dl>
						<dt>详情图片<small>*</small></dt>
						<dd style="width:725px;">
							<div class="pics">
								<ul class="clearfix" id="ul_pics" style="margin-bottom:35px;margin-top:-40px;">
									<li class="item"> <a class="picture_add" onclick="show_pics_box()">+加图</a> </li>
								</ul>
							</div>
						</dd>


						<div class="modal fade" id="modal_upload">
							<div class="modal-dialog">
								<div class="modal-content">
									<div class="modal-header">
										<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
										<h4 class="modal-title">上传图片</h4>
									</div>
									<div class="modal-body">
										<div class="form-inline">
											<dt class="control-dt">网络图片</dt>
											<input type="text" class="form-control" id="pic_url" style="margin:0 10px;width:300px" placeholder="请贴入网络图片地址" autocomplete="off" />
											<button type="button" class="btn btn-primary" onclick="getPicUrl()">提取</button>
										</div>
										<div class="form-inline clearfix" style="margin:15px 0 0">
											<dt class="control-dt" style="float:left">本地图片</dt>
											<div id="photos_area" class="photos_area">
												<a class="cover_btn" id="cover_btn_big"><span>+</span></a>
											</div>
										</div>
										<div class="controls preview-container"></div>
									</div>
									<div class="modal-footer">
										<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
										<button type="button" class="btn btn-primary" onclick="upload_complete()">上传</button>
									</div>
								</div>
							</div>
						</div>
						<link rel="stylesheet" href="bootstrap/bootstrap/css/bootstrap.min.css" />
						<!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
						<script src="bootstrap/jquery.js"></script>
						<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
						<script src="bootstrap/bootstrap/js/bootstrap.min.js"></script>
						<script type="text/javascript" src="bootstrap/plupload/plupload.full.min.js"></script>
						<script type="text/javascript" src="bootstrap/uploads.js"></script>
					</dl>




					<!--<?php if($cfg_localfile=='Y'){ ?>
                    <dl>
                    <div>
                        <div style="float:left"><dt>模板下载地址</dt>
                            <input type='text' name="softurl1" id="softurl1" value="" style='width:350px;border:1px solid #d8d8d8;padding:5px;height:40px;line-height:40px;'  class='intxt' placeholder="rar,zip格式" value='' />
                        </div>
                        <div class="uploader-container"  style="float:left;">
                            <div id="zipPicker"></div>
                        </div>
                        <div id="thelistzip" class="uploader-list" style="padding-top:45px;">
                            <div id="" class="item">
                                    <h4 class="info"></h4>
                             </div>
                        </div>
                    </div>
                    </dl>
                    <?php } ?>-->

					<dl>
						<dt>关键字<small>*</small></dt>
						<dd><textarea style="width:700px;border:1px solid #e4e4e4;height:100px;box-sizing:border-box;padding:5px;" name="tags" placeholder="多个词请用空格隔开，准确详细的关键词使素材更容易被搜索和下载"></textarea></dd>
					</dl>
					<dl>
						<dt>素材说明</dt>
						<dd style="margin-left:-65px;">
							<textarea name="body" id="body" rows="8" cols="60"></textarea>
							<script type="text/javascript">var ue = new baidu.editor.ui.Editor();ue.render("body");</script>
						</dd>
					</dl>
					<?php
      	//管理员才显示此按钮
      	if($cfg_ml->isAdmin==1){
					?>
					<p class="sc-radio">
						<label>是否精品 <small>*</small></label>
						<input type="radio" name="goods" class="np" value="1">是
						<i><input type="radio" name="goods" class="np" value="0" checked="">否</i>
					</p>
					<?php  }?>
					<?php
      if($safe_faq_send == '1'){
      	$faqkey = array_rand($safefaqs);
      ?>
					<dl class="cellBg">
						<dt>验证问题</dt>
						<dd><?php echo $safefaqs[$faqkey]['question'];?> (答案:<?php echo $safefaqs[$faqkey]['answer'];?>)<input class="intxt" name="safeanswer" type="text" id="safeanswer" size="25" style='width:250px;'/>
							<input type="hidden" name="faqkey" value="<?php echo $faqkey;?>" />
						</dd>
					</dl>
					<?php
   		 }
      	//游客强制加验证码，会员则判断后台开关
      	if(preg_match("/3/",$safe_gdopen)){
      ?>
					<dl class="cellBg">
						<dt>验证码</dt>
						<dd>
							<input name="vdcode" type="text" id="vdcode" maxlength="100" autocomplete="off" class="intxt" style='width:150px;text-transform:uppercase;' />
							<img src="../include/vdimgck.php" alt="看不清？点击更换" align="absmiddle" style="cursor:pointer" onclick="this.src=this.src+'?'" />
						</dd>
					</dl>
					<?php  }?>

					<div class="sub-pk">
						<input type="submit" class="sczp_button" value="立即发布">
					</div>
					</dl>
				</div>
			</div>

		</form>

	</div>

</div>

<script type="text/javascript" src="webupload/webuploader.js"></script>

<script>
    //保留两位小数
    function formatFloat(src, pos)
    {
        return Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
    }
    $(function(){
        uploaderZip = WebUploader.create({
            pick: {
                id: '#zipPicker',
                dt: '上传本地文件(最大50MB)',
                multiple:false,
                duplicate :true
            },

            formData: {
                "token":"<?php echo $upToken;?>",

            },
            swf: 'webupload/Uploader.swf',
            server: 'http://up.qiniu.com/',
            accept: {
                title: 'Files',
                extensions: 'zip,rar,gzip',
                mimeTypes : '.zip,.rar,.gzip'
            },
            fileNumLimit: 3,
            auto:true,
            fileSingleSizeLimit: 500 * 1024 * 1024    // 50MB
        });

        uploaderZip.on('fileQueued', function( file ) {
            $('#thelistzip').append( '<div id="' + file.id + '" class="item">' +
                '</div>' );
            filetype = file.ext;

            var key="";
            var now=new Date();
            key="<?php echo 'user/'.$cfg_ml->M_ID."/".date("Ymd").rand(10000,99999).'.';?>"+filetype;
            uploaderZip.options.formData.key = key;
        });

        uploaderZip.on( 'uploadSuccess', function( file ) {
            //$( '#'+file.id ).find('p.state').text('已上传');
        });

        uploaderZip.on( 'uploadError', function( file ,reason ) {
            uploaderZip.reset();
            alert('上传出错');
        });


        uploaderZip.on( 'uploadComplete', function( file) {
            $( '#'+file.id ).find('.progress').fadeOut();
            //$(".item").hide();
        });

        uploaderZip.on( 'uploadAccept', function( file, data,response ) {
            if ( response.hasError ) {
                // 通过return false来告诉组件，此文件上传有错。
                return false;
            }
            console.log(file);
            filesize=formatFloat(file.total/1048756, 2);
            $("#softsize").val(filesize);
            $("#softurl1").val("<?php echo $cfg_qnurl?>"+data.key);

            return true;
        });
        uploaderZip.on('uploadProgress', function( file, percentage ) {
            var $li = $( '#'+file.id ),
                $percent = $li.find('.progress .progress-bar');

            // 避免重复创建
            if ( !$percent.length ) {
                $percent = $('<div class="progress progress-striped active">' +
                    '<div class="progress-bar" role="progressbar" style="width: 0%">' +
                    '</div>' +
                    '</div>').appendTo( $li ).find('.progress-bar');
            }


            $percent.css( 'width', percentage * 100 + '%' );
        });
        uploaderZip.onError = function( code ) {

            if(code=="Q_EXCEED_NUM_LIMIT"){
                alert("超出最大文件数");
            }
            if(code=="F_DUPLICATE"){
                alert("文件重复");
            }
            if(code=="F_EXCEED_SIZE"){
                alert("文件体积不能高于50MB");
            }
        };


    });


</script>
<script>
    $(function(){
        $(".webuploader-pick").text("上传本地文件(最大50MB)");
    })
</script>
<!--footer-->
<?php include(DEDEMEMBER. "/templets/footer.htm"); ?>

<script type="text/javascript">
    $(document).ready(function(){
        ajaxUpload(
            'upload_button',
            2048,
            'upface/upload.php?form_name=userfile&file_size=2048&type=pic&mid=<?php echo $cfg_ml->M_ID;?>',
            'userfile',
            "$(\".img_div\").show();$(\"#litpics\").attr('value', obj.filename);$(\"#litpic\").attr('src', obj.filename);$(\"#is_upload\").val('1');document.getElementById(\"upmsg\").innerText=\"预览图上传成功\";",
            'loadimg'
        );

    });
</script>
<script type="text/javascript" src="templets/js/ajaxaddup.js"></script>
<script>
    //左边导航
    var as = document.querySelectorAll('.left_menu a');
    var spans = document.querySelectorAll('.left_menu .icons');
    for(var i=0,len=as.length;i<len;i++){

        spans[i].clazz = spans[i].className;
        as[i].index = i;
        as[i].onmouseenter = mouseenterHandler;
        as[i].onmouseleave = mouseleaseHandler;
    }
    function mouseenterHandler(e){
        if(!/_h$/.test(spans[this.index].clazz)){
            spans[this.index].className = spans[this.index].clazz + '_h';
        }
    }
    function mouseleaseHandler(e){
        spans[this.index].className = spans[this.index].clazz;
    }


</script>

</body>
</html>